package com.gitee.wsl.eventbus.event4k

import com.gitee.wsl.struct.register.RegisterHook

//package com.github.nort3x.event4k

internal typealias BagValue = MutableMap<RegisterHook<Any?>, EventHandler<Any?, Any?>>

interface Event4kConcurrentBag {

    suspend fun <T> computeFromKeyIfExist(key: String, computer: (BagValue) -> T): T?

    suspend fun <T> update(key: String, computer: (BagValue) -> Pair<BagValue,T> ): T

    suspend fun removeRegisterHook(key: String, hook: RegisterHook<Any?>)

    suspend fun removeAll()

    fun isExits(key: String): Boolean
}


